package org.tity.test.network;

import org.tity.commons.network.webservice.WebServiceClient;

import com.alibaba.fastjson.JSONObject;

public class BPMClient {
	
	public String getToDoWSDL()
	{
		return "https://lbpm.auxgroup.com/sys/webservice/sysNotifyTodoWebService?wsdl";
	}
	
	public String getWorkflowWSDL()
	{
//		return "https://lbpm.auxgroup.com/sys/webservice/flowWebService";
		return "https://lbpm.auxgroup.com/sys/webservice/flowWebService?wsdl";
	}
	
	
	
	private WebServiceClient toDoClient;
	private WebServiceClient workflowClient;
	
	private String sysId=null;
	private String language=null;
	
	public BPMClient (String sysId,String language) {
		
		this.sysId=sysId;
		this.language=language;
		
	}
	
	public BPMClient (String sysId) {
		
		this.sysId=sysId;

	}
	
	
	
	public static void main(String[] args) {
//		String a=System.getProperty("org.apache.commons.logging.LogFactory");
//		System.setProperty("org.apache.commons.logging.LogFactory","");
//		System.out.println(a);
		BPMClient client=new BPMClient("jd_pms");
		client.init();
		client.getCurrentNodesInfo("pms_general","pms_general_project_end","9c030ea4ffc64704894b8704fc2135b6","163fbdaaf4d016f9b0af45342759a996");
	}


	private void init() {
//		toDoClient=WebServiceClient.getCXFClient(getToDoWSDL());
		workflowClient=WebServiceClient.getAXIS2Client(getWorkflowWSDL());
	}
	
	public void getCurrentNodesInfo(String modelId,String templateFormId,String fromInstanceId,String processId)
	{
	 
		
		JSONObject formId=new JSONObject();
		formId.put("sysId",sysId);
		formId.put("modelId",modelId);
		formId.put("templateFormId",templateFormId);
		formId.put("fromInstanceId",fromInstanceId);

		Object result=workflowClient.invoke("GetCurrentNodesInfo", formId.toJSONString(),processId,language);
//		
		System.out.println(result);
		
		 
//		IntegratedWebServiceProxy c=new IntegratedWebServiceProxy(getWorkflowWSDL());
//		try {
//			String r=c.getCurrentNodesInfo(formId.toJSONString(),processId,language);
//			System.out.println(r);
//		} catch (RemoteException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
		
		
	}
	
	
	
}
